#include <stdio.h>
#include <dlfcn.h>
#include "player.h"

int work_wrap(struct Player *player) {
    void (*work)(struct Player *player);
    void* handle = dlopen("./handle.so", RTLD_LAZY);
    work = dlsym(handle, "work");
    work(player);
    dlclose(handle);
    return 0;
}

void main() {
    struct Player player = {0, 0, 0};
    while(1) {
        work_wrap(&player);
        printf("player x:%d y:%d coin:%d\n", player.x, player.y, player.coin);
        sleep(1);
    }
}
